const app = getApp()
Page({
  data: {
    domainName: app.domainName,
    username:''
  },
  onLoad() {
    var _this=this;
    wx.request({
      url: app.domainName + 'web/?c=getusername',
      method: 'POST',
      data: {openid:app.globalData.openid}, header: { 'content-type': 'application/x-www-form-urlencoded' },
      success: function (res) {
        _this.setData({username:res.data.u.name})
      }});
  },
  addqiu(){
    wx.request({
      url: app.domainName + 'web/?c=can_addqiu',
      method: 'POST',
      data: {openid:app.globalData.openid}, header: { 'content-type': 'application/x-www-form-urlencoded' },
      success: function (res) {
         if(2 == res.data.s){
          wx.redirectTo({url: '/pages/welcome/viewapply'});
          return;
         }
         wx.redirectTo({url: '/pages/welcome/zu'})
      }});
  },
  createqiu(){
    
    wx.request({
      url: app.domainName + 'web/?c=can_createqiu',
      method: 'POST',
      data: {openid:app.globalData.openid}, header: { 'content-type': 'application/x-www-form-urlencoded' },
      success: function (res) {
         if(2 == res.data.s){
          wx.redirectTo({url: '/pages/qguan/index'})
          return;
         }
         wx.navigateTo({url: '/pages/qzhu/index'})
      }});
    
  }
 
})
